from flask import Flask,render_template,Blueprint
from flask_migrate import Migrate
from swager_init import siwa
from flask_siwadoc import SiwaDoc
from config import Doconfig
from model.model import *
from view import *
from tools.login import login_manager

app = Flask(__name__)
siwa.init_app(app)

siwa = SiwaDoc()

app.config.from_object(Doconfig)

login_manager.init_app(app)
from config import ENV

app = Flask(__name__)

if ENV == 'xaingshang':
    app.register_blueprint(user,url_prefix='/user')
    app.register_blueprint(house,url_prefix='/house')
    app.register_blueprint(order,url_prefix='/order')
else:
    app.register_blueprint(back,url_prefix='/back')

app.config.from_object(Doconfig)

app.secret_key = 'asdfgh'

migrate = Migrate()
migrate.init_app(app,db)
db.init_app(app)

login_manager.init_app(app)

@app.route('/<html>')
def look_html(html):
    return render_template(html)

@app.route('/')
def index():
    return render_template('index.html')

if __name__ == '__main__':
    print(app.url_map)
    app.run(host='0.0.0.0',port=9527,threaded=True)

